const express = require("express");
// const { connectRedis } = require("../redis");
const upload = require("../upload");
const router = express.Router();
// let redis = null;
// connectRedis().then((res) => {
//   redis = res;
//   console.log("redis----",redis)
// });
// async () => {
//   const ss = await global.connectRedis();
//   console.log("ssss00-------", ss);
// };

const users_handler = require("../router_handler/users");

/**
 * 获取用户信息
 * 入参 header 里面的token 解析获取两个id
 * 查出用户表和team表
 * 返回 { user: {}, team: {} }
 */
// router.get("/gettoken", users_handler.getToken);

// router.get("/", users_handler.getUsersByRedis);

// 数据保存在Reis上面
// router.post("/saveredis", users_handler.saveToRedisData);

/**
 * 登录
 * 入参 邮箱
 * 更具邮箱获取userId teamId 生成token
 * 返回 {token: }
 */
router.post("/login", users_handler.login);

module.exports = router;
